﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _01_多相机_框架
{
    public static class TableLayoutPanelClass
    {
        public static TableLayoutPanel CreateTableLayoutPanelByPercent(float[] column, float[] row)
        {
            //实例化布局器
            TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();
            //设置布局器的列数
            tableLayoutPanel.ColumnCount = column.Length;
            for (int i = 0; i < column.Length; i++)
            {
                tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, column[i]));
            }
            //设置布局器的行数
            tableLayoutPanel.RowCount = row.Length;
            for (int i = 0; i < row.Length; i++)
            {
                tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, row[i]));
            }
            //设置填充满整个控件
            tableLayoutPanel.Dock = DockStyle.Fill;
            //返回
            return tableLayoutPanel;
        }
    }
}
